import http from "@/utils/request/httpRequest.ts";
import type { ListPagination, ListType } from "@/types/commonType.ts";
import type { UserAddType, UserEditType, UserListType } from "@/types/UserType.ts";

// 用户查询
export const getUserList = (params: ListPagination & {
    username: string,
}) => http.get<ListType<UserListType[]>>('sys/user/getUserList', {
    params
})
// 用户添加
export const postUserAdd = (data: UserAddType) => http.post('sys/user/add', data)
// 用户删除
export const postUserDelete = (id: string) => http.post<string>('sys/user/delete?id=' + id)
// 用户编辑
export const postUserUpdate = (data: UserEditType) => http.post('sys/user/update', data)
// 下载导入模版
export const downLoad = (data) => http.get("file/downloadTemplate", {
    responseType: "blob",
    params: data
})

//   重置密码
export const resetPassword = (userId: number) => http.get(`sys/user/resetPassword?userId=${userId}`)